//
//  IMMessage.m
//  MLIM
//
//  Created by molon on 15/6/25.
//  Copyright (c) 2015年 molon. All rights reserved.
//

#import "IMMessage.h"
#import "IMCommon.h"

@implementation IMMessage

- (instancetype)initWithCoder:(NSCoder *)coder
{
    self = [super init];
    if (self) {
        self.messageId = [coder decodeObjectForKey:SELSTR(messageId)];
        self.conversationId = [coder decodeObjectForKey:SELSTR(conversationId)];
        self.clientId = [coder decodeObjectForKey:SELSTR(clientId)];
        self.status = [[coder decodeObjectForKey:SELSTR(status)] integerValue];
        self.sendTimestamp = [[coder decodeObjectForKey:SELSTR(sendTimestamp)] doubleValue];
        self.localMessageId = [coder decodeObjectForKey:SELSTR(localMessageId)];
    }
    return self;
}

- (void)encodeWithCoder:(NSCoder *)aCoder {
    [aCoder encodeObject:self.messageId forKey:SELSTR(messageId)];
    [aCoder encodeObject:self.conversationId forKey:SELSTR(conversationId)];
    [aCoder encodeObject:self.clientId forKey:SELSTR(clientId)];
    [aCoder encodeObject:@(self.status) forKey:SELSTR(status)];
    [aCoder encodeObject:@(self.sendTimestamp) forKey:SELSTR(sendTimestamp)];
    [aCoder encodeObject:self.localMessageId forKey:SELSTR(localMessageId)];
}

- (id)simpleDescription
{
    return @"新消息";
}
@end
